{% extends 'base.html' %}

{% block extra_css %}
<link rel="stylesheet" href="/static/css/grades.css">
{% endblock %}

{% block content %}
<div class="delete-container">
    <h1 class="page-title"><i class="fas fa-exclamation-triangle"></i> 确认删除</h1>
    
    <div class="delete-warning">
        <div class="warning-icon">
            <i class="fas fa-exclamation-triangle"></i>
        </div>
        <h2>您确定要删除这个班级吗？</h2>
        <p>此操作无法撤销，删除后该班级的所有相关信息都将被移除。</p>
    </div>
    
    <div class="delete-info">
        <h3><i class="fas fa-info-circle"></i> 要删除的班级信息：</h3>
        <div class="info-grid">
            <div class="info-row">
                <span class="info-label">🏫 班级名称：</span>
                <span class="info-value delete-highlight">{{ grade.name }}</span>
            </div>
            <div class="info-row">
                <span class="info-label">📝 班级描述：</span>
                <span class="info-value">{{ grade.description|default:"暂无描述" }}</span>
            </div>
            <div class="info-row">
                <span class="info-label">📅 创建时间：</span>
                <span class="info-value">{{ grade.created_at|date:"Y年m月d日 H:i" }}</span>
            </div>
            <div class="info-row">
                <span class="info-label">🔄 最后更新：</span>
                <span class="info-value">{{ grade.updated_at|date:"Y年m月d日 H:i" }}</span>
            </div>
        </div>
    </div>
    
    <form method="post" class="delete-form">
        {% csrf_token %}
        <div class="delete-actions">
            <a href="{% url 'grades:grade_list' %}" class="btn-secondary">
                <i class="fas fa-times"></i> 取消删除
            </a>
            <button type="submit" class="btn-danger" onclick="return confirm('确定要删除这个班级吗？此操作不可恢复。')">
                <i class="fas fa-trash"></i> 确认删除
            </button>
        </div>
    </form>
</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
    // 添加删除确认对话框
    const deleteForm = document.querySelector('.delete-form');
    if (deleteForm) {
        deleteForm.addEventListener('submit', function(e) {
            const confirmed = confirm('您确定要删除班级 "{{ grade.name }}" 吗？\n\n此操作无法撤销！');
            if (!confirmed) {
                e.preventDefault();
            }
        });
    }
});
</script>
{% endblock %}